package com.kunpan.admin.constant;

import java.util.Locale;

/**
 * 通用常量信息
 *
 * @author ruoyi
 */
public class Constants {
    /**
     * UTF-8 字符集
     */
    public static final String UTF8 = "UTF-8";

    /**
     * GBK 字符集
     */
    public static final String GBK = "GBK";

    /**
     * 系统语言
     */
    public static final Locale DEFAULT_LOCALE = Locale.SIMPLIFIED_CHINESE;

    /**
     * www主域
     */
    public static final String WWW = "www.";

    /**
     * http请求
     */
    public static final String HTTP = "http://";

    /**
     * https请求
     */
    public static final String HTTPS = "https://";

    /**
     * 验证码有效期（分钟）
     */
    public static final Integer CAPTCHA_EXPIRATION = 2;

    /**
     * 存入缓存的图形验证码的key
     */
    public static final String CAPTCHA_KEY = "share:captcha-key:";

    public static final String CAPTCHA_KEY_IP = "share:captcha-key:ip:";

    /**
     * 资源映射路径 前缀
     */
    public static final String RESOURCE_PREFIX = "/profile";

    /**
     * minio的资源映射路径 前缀
     */
    public static final String MINIO_RESOURCE_PREFIX = "/minio";


    /**
     * 自动识别json对象白名单配置（仅允许解析的包名，范围越小越安全）
     */
    public static final String[] JSON_WHITELIST_STR = {"org.springframework", "com.kunpan.admin"};

    /**
     * 定时任务白名单配置（仅允许访问的包名，如其他需要可以自行添加）
     */
    public static final String[] JOB_WHITELIST_STR = {"com.applet.quartz.task"};

    /**
     * 定时任务违规的字符
     */
    public static final String[] JOB_ERROR_STR = {"java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
            "org.springframework", "org.apache", "com.applet.common.utils.file", "com.applet.common.config", "com.applet.generator"};
    public static final int ACCOUNT_BANNED = 0;
    public static final int ACCOUNT_NORMAL = 1;

    /**
     * session保存用户信息的键
     */
    public static final String LOGIN_USER = "KUNKUN";

    /**
     * session保存用户信息的键
     */
    public static final String LOGIN_KEY = "satoken:login:token:";
    public static final String SET_CREATE_TIME = "setCreateTime";
    public static final String SET_UPDATE_TIME = "setUpdateTime";

    public static final String SET_SHARE_TIME = "setShareTime";
    public static final String SET_EXPIRE_TIME = "setExpireTime";
    public static final String AUTHOR_PROFILE_KEY = "author:profile:key";

    /**
     * 默初始空间,300MB
     */
    public static final Long INITIAL_SPACE = 314572800L;
    public static final String FILE_KEY = "file:key:";

    /**
     * 防重提交 redis key
     */
    public static final String REPEAT_SUBMIT_KEY = "repeat_submit:";

    /**
     * 文件大小前缀
     * */
    public static final String FILE_SIZE_PREFIX = "file:fileMD5:%s:fileSize:";

    /**
     * 文件大小前缀
     * */
    public static final String FILE_PATH_PREFIX = "file:fileMD5:%s:chuck";
    public static final String FILE_DELETE_PREFIX = "file:fileMD5:%s*";

    /**
     *
     * */
    public static final String FILE_DELETE_SOURCES_PREFIX = "file:fileMD5:%s:sources:";

    /**
     * 分片文件大小前缀
     * */
    public static final String CHUNK_FILE_SIZE_PREFIX = "chunkFileSize:";
    public static final String VERIFICATION_CODE_PREFIX = "verification:code:";
    public static final String VERIFICATION_COUNT_PREFIX =  "verification:count:";


    /**
     * 用户文件缓存键
     * */
    public static final String USER_FILE_CACHE_KEY = "user:%d*";

    public static final String FILE_TYPE_LIST_CACHE_KEY = "user:%d:type:%d*";

    public static final String FILE_TYPE_LIST_CACHE_KEY_PREFIX = "user:%d:type*";
    /**
     * 文件列表缓存key
     * */
    public static final String FILE_PAGE_LIST_CACHE_KEY = "user:%d:type:%d:page:%d:size:%d";
    public static final String FILE_LIST_TOTAL_CACHE_KEY = "user:%d:type:%d:total";
    public static final String REFRESH_TOKRN_KEY = "refresh:%d:mark:%s";
    public static final String CHUCK_FILEMD5 = "chuck:file:%s";
    public static final String SA_TOKEN_AUTHOR= "Authorization:login:token:";
    public static final String DEFAULT_AVATAR = "https://kun.xn--qwu583e99m.fun:9000/kunpan/pan/image/kun.png";
}
